<template>
	<view class="items">
				 <view class="item" v-for="item in items" :key="item.id" @tap="enterDetail(item.id)">
					 <image :src="item.pic" mode="scaleToFill"></image>
					 <view class="item-info">
						 <text class="name">{{item.name}}</text>
						 <view class="action">
							 <text class="price">{{item.minPrice}}</text>
							 <uni-icons type="plus-filled" color="#f66" size="30"></uni-icons>
						 </view>
					 </view>
				 </view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				items: []
			}
		},
		methods: {
			enterDetail(id){
				uni.navigateTo({
					url: "/pages/detail/detail?id="+id
				})
			},
			getItems(cateId) {
				this.$request("/shop/goods/list/v2", {
					method: "POST",
					data: {
						categoryId: cateId
					}
				}).then(res => {
					if (res.code === 0) {
						this.items = res.data.result
					}
				})
			}
		},
		onLoad(options) {
			
			this.getItems(options.cateId)
		}
	}
</script>

<style lang="scss" scoped>
.items{ 
	.item{
		display: flex;
		align-items: center;
		image{
			width: 180rpx;
			height:180rpx;
		}
		.item-info{
			flex: 1;
			font-size: 12px;
		}
	}
}
</style>
